<%--
  作者:张伟

  联系:adamzzww@163.com
  时间:2016-11-27
  说明:用户列表
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <title><%=Global.TITLE%>
    </title>
    <%@include file="../../desktop/include/assets.jsp" %>
    <link href="<%=_asset_path%>/zui-1.5.0/lib/chosen/chosen.css" rel="stylesheet">
    <script type="text/javascript" src="<%=_asset_path%>/zui-1.5.0/lib/chosen/chosen.min.js"></script>
    <%
        String url = request.getContextPath() + Global.PATH + "/user";
    %>
    <style>

    </style>
</head>
<body>
<div class="page-wrapper">

    <%@include file="../../desktop/include/navigator.jsp" %>

    <div>
        <ul class="breadcrumb">
            <li><a href="<%=request.getContextPath()%><%=Global.INDEX_PAGE%>">首页</a></li>
            <li><a href="#" class="active">用户管理</a></li>
        </ul>
    </div>

    <!--标题-->
    <h3>用户管理</h3>

    <!--内容开始-->
    <div class="row clearfix">
        <div class="col-md-12 column customcontainer">
            <div class="query">
                <form name="queryForm" action="<%=url%>" method="get">
                    <%--<input class="form-control" type="text" name="userName" id="userName" value="" placeholder="用户姓名"--%>
                    <%--title="请输入用户姓名">--%>
                    <select name="userName" class="my_select_box" data-placeholder="选择用户姓名..">
                        <option value=""></option>
                        <c:if test="${!empty nameList }">
                            <c:forEach items="${nameList }" var="name">
                                <option value="${name}">${name}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                    <button type="submit" class="btn btn-default">查询</button>
                </form>
            </div>

        </div>
        <div class="col-md-12 column customcontainer">
            <div class="cu">
                <table class="table table-bordered">
                    <tr>
                        <th width="50">序号</th>
                        <th>登录名</th>
                        <th>真实姓名</th>
                        <th style="width: 200px">所在部门</th>
                        <th>所属角色</th>
                        <th>创建人</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    <c:if test="${!empty page.getContent() }">
                        <c:forEach items="${page.getContent() }" var="user" varStatus="status">
                            <tr>
                                <td><c:out value="${status.index+1}"> </c:out></td>
                                <td>${user.loginName }</td>
                                <td>${user.userName }</td>
                                <td>${user.dept.deptName }</td>
                                <td>${user.role.roleName }</td>
                                <td>${user.creator }</td>
                                <td><fmt:formatDate value="${user.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                <td>
                                    <button type="button" class="btn btn-xs btn-success" data-toggle="modal"
                                            data-iframe="<%=url%>/${user.userId }"
                                            data-title="编辑用户信息">编辑
                                    </button>
                                    <a href="<%=url%>/${user.userId }/reset" class="btn btn-xs btn-danger">重置</a>
                                </td>
                            </tr>
                        </c:forEach>
                    </c:if>
                </table>
                <!--按钮+分页开始-->
                <div class="btn_nav">
                    <div class="left">
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-title="新增用户信息"
                                data-iframe="<%=url%>/add">增加
                        </button>
                        <button type="button" class="btn btn-default" onclick="javascript:history.go(-1);"/>
                        返回</button>
                    </div>
                    <div class="right">
                        <ul id="pagination" class="pager pagination-sm pagination">
                        </ul>
                    </div>
                </div>
                <!--按钮+分页结束-->
            </div>
        </div>
    </div>

    <script>

        $(".my_select_box").chosen({
            disable_search_threshold: 10,
            no_results_text: "抱歉, 没有找到!",
            width: "20%"
        });

        $("#pagination").twbsPagination({
                    first: '首页',
                    prev: '上一页',
                    next: '下一页',
                    last: '尾页',
                    totalPages:  ${page.getTotalPages() },
                    visiblePages: ${page.getTotalPages() } < 5 ? ${page.getTotalPages()} : 5,
                href
        :
        '?pageIndex={{number}}'
        })
        ;

    </script>

    <%@include file="../../desktop/include/bottom.jsp" %>

</div>
</body>
</html>
